00001
00002
00003
00004
00005
00006 #ifndef _input_stream_h
00007 #define _input_stream_h
00008
00009 #include <string>
00010 #include <fstream>
00011
00012 #ifdef USE_GOSS
00013 #include <boost/smart_ptr/shared_ptr.hpp>
00014 #include "gridpack/parallel/distributed.hpp"
00015 #include "gridpack/network/base_network.hpp"
00016 #include "gridpack/component/base_component.hpp"
00017 #include "gridpack/utilities/exception.hpp"
00018 #include <activemq/library/ActiveMQCPP.h>
00019 #include <decaf/lang/Thread.h>
00020 #include <decaf/lang/Runnable.h>
00021 #include <decaf/util/concurrent/CountDownLatch.h>
00022 #include <decaf/lang/Integer.h>
00023 #include <decaf/lang/Long.h>
00024 #include <decaf/lang/System.h>
00025 #include <activemq/core/ActiveMQConnectionFactory.h>
00026 #include <activemq/util/Config.h>
00027 #include <cms/Connection.h>
00028 #include <cms/Session.h>
00029 #include <cms/TextMessage.h>
00030 #include <cms/BytesMessage.h>
00031 #include <cms/MapMessage.h>
00032 #include <cms/ExceptionListener.h>
00033 #include <cms/MessageListener.h>
00034 using namespace activemq::core;
00035 using namespace decaf::util::concurrent;
00036 using namespace decaf::util;
00037 using namespace decaf::lang;
00038 using namespace cms;
00039 #endif
00040
00041
00042
00043 namespace gridpack{
00044 namespace stream{
00045
00046 class InputStream {
00047 public:
00048
00049
00050
00051
00052 InputStream();
00053
00054
00055
00056
00057 ~InputStream();
00058
00059
00060
00061
00062
00063
00064 bool openFile(std::string file);
00065
00066 #ifdef USE_GOSS
00067
00068
00069
00070
00071
00072
00073
00074 bool openChannel(const char *topic, const char *URI, const char *username,
00075 const char *passwd);
00076 #endif
00077
00078
00079
00080
00081 void close();
00082
00083
00084
00085
00086
00087
00088 bool nextLine(std::string &line);
00089
00090
00091
00092
00093
00094 bool isOpen();
00095
00096 private:
00097
00098 std::ifstream p_fout;
00099
00100 bool p_srcFile;
00101
00102 bool p_srcChannel;
00103
00104 bool p_isOpen;
00105
00106 };
00107
00108
00109 }
00110 }
00111
00112
00113 #endif // _input_stream_h